package shujia.day01;

/*
    逻辑运算符
    & | ^ !  && ||

    使用特点：
        参与逻辑运算的的值必须是布尔类型
 */
public class LuoJiOpt {
    public static void main(String[] args) {
        int a = 3;
        int b = 4;

        // & 有false则false
        System.out.println(a > 3 & b > 4); // false
        System.out.println(a == 3 & b > 4);//false
        System.out.println(a == 3 & b == 4); // true
        System.out.println(a > 3 & b == 4); // false

        System.out.println("-----------");
        // | 有true则true
        System.out.println(a > 3 | b > 4); // false
        System.out.println(a == 3 | b > 4); //true
        System.out.println(a == 3 | b == 4); // true
        System.out.println(a > 3 | b == 4); // true
        System.out.println("-----------");
        System.out.println(!(a==3));
        System.out.println("-----------");
        // ^  相同为false, 不同则true
        System.out.println(a > 3 ^ b > 4); // false
        System.out.println(a == 3 ^ b > 4); //true
        System.out.println(a == 3 ^ b == 4); // false
        System.out.println(a > 3 ^ b == 4); // true

    }
}
